<!DOCTYPE html>

<html>
<head>
    <!--[if lte IE 9]>
    <div class="lowIE">
        温馨提示：您目前的ie浏览器版本过低，网站部分功能无法正常使用，建议尽快升级或者更换其他浏览器：
        <a href="http://www.chromeliulanqi.com/" target="_blank">点击推荐下载</a>
    </div>
    <![endif]-->
    <title>智慧灯控平台</title>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="renderer" content="webkit">
    <link rel="shortcut icon" href="/frame/login/img/logonew.png" type="image/x-icon" />
    <meta http-equiv="Cache-Control" content="no-siteapp">
    <link rel="stylesheet" href="/system/common/libs/bootstrap/css/bootstrap.min.css"/>
    <link rel="stylesheet" type="text/css" href="/system/common/libs/bootstrap/css/font-awesome.min.css"/>
    <link rel="stylesheet" type="text/css" href="/system/common/custom/css/reset.css"/>
    <link rel="stylesheet" type="text/css" href="/system/common/libs/toastr/toastr.min.css">
    <link rel="stylesheet" type="text/css" href="/frame/index/css/system-index_copy.css"/>
    <link rel="stylesheet" href="/system/common/libs/layer/skin/layer.css"/>
    <link rel="stylesheet" type="text/css" href="/frame/css/other.css" class="css-href"/>
    <link rel="stylesheet" type="text/css" href="/system/common/custom/css/menu-dark.css" class="menu-href"/>
</head>
<body class="myBody">

<!--顶部工作区-->
<div class="top-block main-color-blue" style="background-color: rgba(255,255,255,.5)!important">
    <!--云平台-->
    <div class="fl logo" style="font-size: 20px">
        <span style="display: inline-block; " ><img src="/frame/login/img/logonew.png" style="height: 40px;margin-top: -6px"/></span>
        智慧灯控平台
    </div>
    <div class="top-menu" style="display: none"></div>
    <div class="fr" style="margin-right:10px">
        <div class="nav fl">
            <ul>
                <li title="部门选择" id="department" style="display: none">
                    <div class="department-container">
                        <span class="fa fa-sitemap position-icon"></span>
                        <span class="department-text">部门选择</span>
                        <div class="change-department">
                            <ul class="department-list">
                            </ul>
                        </div>
                    </div>
                </li>
                <!--<li title="主题" id="theme">-->
                <!--<div class="theme">-->
                <!--<img src="/system/common/custom/img/icon.png" height="16" width="16"/>-->
                <!--<div class="change-color">-->
                <!--&lt;!&ndash;<span class="triangle-right"></span>&ndash;&gt;-->
                <!--&lt;!&ndash;<div class="menu-theme" style="background-color: #fff;color: #666">菜单主题浅色</div>&ndash;&gt;-->
                <!--&lt;!&ndash;<div class="menu-theme" style="background-color: #999;">菜单主题深色</div>&ndash;&gt;-->
                <!--<ul>-->
                <!--<li style="color: #337ab7"><i class="fa fa-exchange"></i>深蓝</li>-->
                <!--<li style="color: #5bc0de"><i class="fa fa-exchange"></i>浅蓝</li>-->
                <!--<li  style="color: #5cb85c "><i class="fa fa-exchange"></i>绿色</li>-->
                <!--<li style="color: #f0ad4e "><i class="fa fa-exchange"></i>黄色</li>-->
                <!--<li style="color: #d9534f"><i class="fa fa-exchange"></i>红色</li>-->
                <!--<li style="color: #4e97d9"><i class="fa fa-exchange"></i>蓝色</li>-->
                <!--</ul>-->
                <!--</div>-->
                <!--</div>-->
                <!--</li>-->
                <li class="myMessage" title="消息">
                    <span class="fa fa-comments" ></span>
                </li>
                <li class="information fr self-info "  id="user_info" title="用户信息">
                    <span id="userName" class="fa fa-user"></span>
                </li>
                <li id="logout_system" title="退出登录">
                    <span class="fa fa-sign-out"></span>
                </li>
            </ul>
        </div>
    </div>
</div>

<!--顶部菜单区-->

<!--顶部菜单区-->
<!--<div class="top-menu"></div>-->
<script id="topNavigationTemplate" type='text/x-handlebars-template'>
    {{#each topMenus}}
    {{#if first}}
    <!--<div class="menu-tab fl menu-tab-base active" data-id='{{menuid}}'><span><i class='{{icon}}'></i></span>&nbsp;&nbsp;{{name}}</div>-->
    <div class="menu-tab fl menu-tab-base active" data-id='{{menuid}}'><span><i class='{{icon}}'></i></span>{{name}}</div>
    {{else}}
    <!--<div class="menu-tab fl menu-tab-base" data-id='{{menuid}}'><span><i class='{{icon}}'></i></span>&nbsp;&nbsp;{{name}}</div>-->
    <div class="menu-tab fl menu-tab-base" data-id='{{menuid}}'><span><i class='{{icon}}'></i></span>{{name}}</div>
    {{/if}}
    {{/each}}
</script>

<div id="main-content" class="main-content">
    <!--框架左侧导航栏-->
    <div class="left-block">
        <ul class="navigation">
            <li><a href="javascript:void(0)" class="navButton-stretch" style="letter-spacing: 4px;padding-left: 17px;font-size: 14px"><span class="glyphicon glyphicon-menu-hamburger"></span>菜&nbsp;&nbsp;&nbsp;单</a></li>
        </ul>
    </div>
    <script id="navigationTemplate" type="text/x-handlebars-template">
        {{#each this}}
        <li>
            <a name="{{id}}" href="javascript:void(0)" data-url="{{url}}" class='{{#if @first}}navButton-active{{/if}}' data-options="{{jsonToString this}}">
                <span class="navButton-icon {{icon}}"></span>
                <span class="break-word-text navButton-text" title="{{text}}"> {{text}} </span>
                {{#if childInfo}}
                <span class="navButton-spread fa fa-fw fa-angle-down"></span>
                {{/if}}
            </a>
            {{#if childInfo}}
            <ul class="second-menu">
                {{#with childInfo}}
                {{#each this}}
                <li>
                    <a name="{{id}}" href="javascript:void(0)" data-url="{{url}}"  data-options="{{jsonToString this}}" >
                        <!--<span class="navButton-icon {{icon}}"></span>-->
                        <span class="break-word-text navButton-text" title="{{text}}"><!--<i class="{{icon}}" style="margin-right:5px;"/> -->{{text}} </span>
                        {{#if childInfo}}
                        <span class="navButton-spread fa fa-fw fa-angle-down"></span>
                        {{/if}}
                    </a>
                    {{#if childInfo}}
                    <ul class="third-menu">
                        {{#with childInfo}}
                        {{#each this}}
                        <li>
                            <a name="{{id}}" href="javascript:void(0)" data-url="{{url}}" data-options="{{jsonToString this}}"
                               data-funcName="{{tab}}">
                                <!--<span class="navButton-icon {{icon}}"></span>-->
                                <span class="break-word-text navButton-text" title="{{text}}"> {{text}} </span>
                            </a>
                        </li>
                        {{/each}}
                        {{/with}}
                    </ul>
                    {{/if}}
                </li>
                {{/each}}
                {{/with}}
            </ul>
            {{/if}}
        </li>
        {{/each}}
    </script>

    <!--框架左部导航小工具-->
    <div class="left-tools">
        <ul class="navigationTools"><li><a name="{{id}}" class="navButton-shrink" href="javascript:void(0)"><span style="display:inherit;font-size: 20px;margin-top: -4px;" class="fa fa-exchange"></span></a></li></ul>
    </div>
    <script id="navigationToolsTemplate" type="x-handlebars-template">
        {{#each this}}
        <li>
            <a name="{{id}}" href="javascript:void(0)" data-url="{{url}}" data-options="{{jsonToString this}}">
                <span class="navButton-icon {{icon}}" style="font-size:14px"></span>
                <span class="break-word-text">{{text}}</span>
            </a>
            {{#with childInfo}}
            <ul class="tools-second-menu">
                {{#each this}}
                <li>
                    {{#hasTriangle @index}}
                    <div class="triangle-left"></div>
                    {{/hasTriangle}}
                    <a name="{{id}}" href="javascript:void(0)" data-url="{{url}}" data-options="{{jsonToString this}}">
                        <span class="break-word-text tools-navButton-text" title="{{text}}">{{text}}</span>
                        {{#if childInfo}}
                        <span class="tools-signOfHasChild fa fa-chevron-circle-right"></span>
                        {{/if}}
                    </a>
                    {{#with childInfo}}
                    <ul class="tools-third-menu">
                        {{#each this}}
                        <li>
                            {{#hasTriangle @index}}
                            <div class="triangle-left"></div>
                            {{/hasTriangle}}
                            <a name="{{id}}" href="javascript:void(0)" data-url="{{url}}" data-options="{{jsonToString this}}">
                                <span class="break-word-text tools-navButton-text" title="{{text}}">{{text}}</span>
                            </a>
                        </li>
                        {{/each}}
                    </ul>
                    {{/with}}
                </li>
                {{/each}}
            </ul>
            {{/with}}
            {{/each}}
        </li>
    </script>
    <!--选项卡区域-->
    <div class="tab-block-box">
        <div class="tab-block">
            <div id="tab-page-pre" class="tab1 tab-page-pre-next">
                <span class="fa fa-angle-left" style="font-size: 17px;margin-top: 7px" title="前一窗口"></span>
            </div>
            <div data-tab_id="indexPage" class="tab-jump tab_index tab tab-active" data-url="./main.html" >首页</div>
            <script type="x-handlebars-template" id="tabTemplate">
                <div class="tab-jump tab tab-created tab-active" data-url="{{tab_url}}" data-tab_id="{{tab_id}}"
                     draggable="true">
                    <span class="break-word-text tab-text">{{tab_text}}</span>

                    <div class="tab-close-container">
                        <div class="tab-close tab-close-active">&times;</div>
                    </div>
                </div>
            </script>
            <div class="tab1 tabButton tabButton-refresh"><span class="fa fa-spinner" aria-hidden="true" aria-hidden="true" title="刷新"></span></div>
            <div class="tab1 tabButton" id="tabButton" style="width:30px"><span class="fa fa-times tabButton-tab-close" aria-hidden="true" title="关闭窗口"></span></div>
            <div id="tab-page-next" class="tab1 tabButton tab-page-pre-next"><span class="fa fa-angle-right" style="font-size: 17px;margin-top: 7px"  title="后一窗口"></span></div>
        </div>
    </div>

    <!--关闭下来菜单-->
    <div class="tab-close-menu">
        <span class="triangle-top"></span>
        <div class="tabButton-close-others">关闭其他</div>
        <div class="tabButton-close-all">关闭所有</div>
    </div>

    <!--框架中部主要工作区-->
    <div class="main-block">
        <iframe name="frameindexPage" class="myFrame" src="/frame/index/home.html"></iframe>
        <script type="x-handlebars-template" id="frameTemplate">
            <iframe class="frame-created myFrame" src="{{url}}" name="frame{{frame_id}}"></iframe>
        </script>
    </div>
    <!--模态框区域-->
    <script id="modalSettingsTemplate" type="text/html">
        <div>
            <div class="form-group">
                <label for="refreshType">设置页面刷新方式</label>
                <select class="form-control" id="refreshType">
                    <option value="0">手动刷新</option>
                    <option value="1">自动刷新</option>
                </select>
            </div>
        </div>
    </script>
</div>

<script src="/system/common/libs/js/jquery.min.js"></script>
<script src="/system/common/libs/toastr/toastr.min.js"></script>
<script src="/system/common/libs/js/handlebars.js"></script>
<script src="/system/common/libs/layer/layer.js"></script>
<script src="/system/common/custom/js/common.js"></script>
<script src="/system/common/custom/js/frameEvent.js"></script>
<script src="/system/common/custom/js/globalApi.js"></script>
<script src="/system/common/custom/js/framework.js"></script>
<script src="/system/common/custom/js/tab-operation.js"></script>
<script src="/system/common/custom/js/navigation-maker.js"></script>
<script src="/system/common/custom/js/hashmap.js"></script>
<script src="/system/common/custom/js/jquery.cookie.js"></script>
<script>
    ;(function (window, document, $, undefined) {
        var pageInfo=new HashMap(),session={};
        function getGlobalPageInfo(key){if(pageInfo){return pageInfo.get(key);}}
        function removeGlobalPageInfo(key){if(pageInfo){pageInfo.remove(key);}}
        function putGlobalPageInfo(key,value){if(pageInfo){pageInfo.put(key,value);}}
        function clearGlobalPageInfo(){if(pageInfo){pageInfo.clear();}}
        window.globalEnv = {
            pageInfo:pageInfo,
            session:session,
            getGlobalPageInfo:getGlobalPageInfo,
            removeGlobalPageInfo:removeGlobalPageInfo,
            putGlobalPageInfo:putGlobalPageInfo,
            clearGlobalPageInfo:clearGlobalPageInfo
        }
    })(window, document, jQuery);

    $(function () {
        //在线心跳
        setInterval(function(){jQuery.ajax({url: "/system/user/online.do",type: "post"});},600000);

        jQuery.ajax({
            url: '/system/user/userInfo.do',
            success: function (res) {
                if(res&&(typeof (res) == "string" )&&res.indexOf("<script>")>=0){
                    alert('登录已失效，请重新登录');top.location.href='/login.html';
                }
                globalEnv.session=res;
                //部门选择
                department(res);
            },
            error: function (res) {

            }

        });

        //个人信息页面。
        $('#user_info').on('click', function () {
            var url ='/frame/index/subpage/userinfo.html';
            if(globalEnv.session['userInfoPage']){
                url =   globalEnv.session['userInfoPage'];
                if(url.indexOf('.')==-1){
                    url ="/system/page/show.do?pageId="+url;
                }
            }
            window.tabOperation.openTabLabel({
                url: url,
                name: "个人中心",
                id: "1045"
            });
        });

        $('#user_task').on('click', function () {window.tabOperation.openTabLabel({url: '/bpm/userTaskList.html', name: "任务中心", id: "1045"});});

        $('#user_histask').on('click', function () {
            window.tabOperation.openTabLabel({
                url: '/bpm/userTaskListHistory.html',
                name: "历史任务",
                id: "histask"
            });
        });

        tabOperation.initializeTabs();

        navigationMaker.initTopNavigation('/system/common/getTopMenusList.do', '/system/common/getChildMenusById.do');
        navigationMaker.navigatorActions('/system/common/getChildMenusById.do');

        //注销
        $('#logout_system').on("click", function () {
            top.layer.open({
                type: 0,
                title: '退出系统',
                skin: 'layui-layer-molv',
                content: "确定退出系统吗?",
                btn: ['<i class="fa fa-check"></i>&nbsp;确定', '<i class="fa fa-close"></i>&nbsp;取消'],
                yes: function (index, layero) {
                    jQuery.ajax({
                        url: '/public/loginOut.do',
                        type: 'post',
                        dataType: 'json',
                        cache: false,
                        success: function (res) {
                            window.location.href = "/login.html";
                        },
                        error:function () {
                            $.x_alertMsg("请检查数据是否正确，稍后操作！");
                        }
                    });
                    top.layer.close(index);
                },
                cancel: function () {
                }
            });

        });

        //查看消息列表
        $('.myMessage').on("click", function () {
            window.tabOperation.openTabLabel({
//                url: "/system/base/messageList.html?module=message"
                url: "/system/page/show.do?pageId=sysMessageListMy&module=", name: '我的消息', id: "myMessage"});
        });

        /**
         * 提示信息
         */
        toastr.options.onclick = function (e) {window.tabOperation.openTabLabel({url: "/system/page/show.do?pageId=sysMessageListMy&module=", name: '我的消息', id: "myMessage"});};
        /**
         * 消息条数展示
         */
        function showMessageNum() {
            //获取未读消息
            jQuery.ajax({
                url: '/system/common/dataList.do?source=newMessageNum&returnDataType=2',
                type: 'post',
                dataType: 'json',
                global: false,
                cache: false,
                success: function (res) {
                    if (res["status"] == "1") {
                        if(res["data"]&&res["data"]["rows"]&&res["data"]["rows"].length>0&&res.data.rows[0]["num"]){
                            $(".label-primary").show().html(res.data.rows[0]["num"]);
                        }
                    }
                }
            });

            //获取最新的信息
            jQuery.ajax({
                url: '/system/user/getNewMessage.do',
                type: 'post',
                dataType: 'json',
                cache: false,
                global: false,
                success: function (res) {
                    if (res.message) {
                        toastr.options = {
                            "closeButton": true,
                            "debug": true,
                            "positionClass": "toast-bottom-right",
                            "onclick": function(){
                                tabOperation.openTabLabel({
                                    url:'/business/zsk/comment.html',
                                    name:"打开页面",
                                    id:randomUUID()
                                },function(){

                                });
                            },
                            "showDuration": "300",
                            "hideDuration": "1000",
                            "timeOut": 10000, //控制显示提示框存在时间  10s
                            "extendedTimeOut": "0",
                            "showEasing": "swing",
                            "hideEasing": "linear",
                            "showMethod": "fadeIn",
                            "hideMethod": "fadeOut"
                        };
                        toastr.info(res.message);
                    }

                    if (res.act && res.act == 'noLogin') {
                        window.location.href = "/login.html";
                    }
                }
            });

        }

//        var sh = setInterval(showMessageNum, 5000);
//        showMessageNum();


        /**
         * 搜索区域
         */
        $('input[name=searchVal]').bind('input propertychange', function () {
            var $this = $(this);
            if ($this.val()) {
                $(".header-search-clear").show();
                $this.css("width", "185");
            } else {
                $(".header-search-clear").hide();
                $this.css("width", "200px");
            }
        });

        $(".header-search-clear").on("click", function () {
            $('input[name=searchVal]').val("").css("width", "200px");
            $(this).hide();
        });

        $('.header-search-button').on("click", function () {
            if ($('input[name=searchVal]').val()) {
                window.tabOperation.openTabLabel({
                    url: "/common/frame/index/subpage/search.html?search=" + $('input[name=searchVal]').val(),
                    name: '搜索信息',
                    id: 20000,
                    hideMenu: true
                });
            } else {
                $.x_alertMsg("请输入关键字后搜索");
            }
        });
    });
    // 左侧导航栏菜单栏及工具栏的相互转换
    $(".navigation").on('click', '.navButton-stretch', function () {
        $(".left-block").hide(70);
        $(".left-tools").show(70);
    });

    $(".navigationTools").on('click', '.navButton-shrink', function () {
        $(".left-tools").hide(70);
        $(".left-block").show(70, function () {
            tabOperation.checkAndDeleteTabByLength();
        });
    });

    //换肤
    $('#theme').on("click",function () {
        $(".change-department").slideUp();
        var target = $('.change-color');
        if ( target.css('display')==='none') {
            target.slideDown();
        }else{
            target.slideUp();
        }
        return false;
    });

    //部门选择
    function department(list) {
        $.each(list.orgList,function (index,value) {
            var tpl = "<li oid='"+value.oid+"'>"+value.orgName+"</li>";
            $(".department-list").append(tpl);
        });
        $(".department-text").text(list.orgJoinName);
        $('#department').on("click",function () {
            $(".change-color").slideUp();
            var target = $(".change-department");
            if ( target.css('display')==='none') {
                target.slideDown();
            }else{
                target.slideUp();
            }
            return false;
        });
        $(".change-department").on("click","li",function () {
            var orgId = $(this).attr("oid");
            jQuery.ajax({
                url: '/system/user/setOrg.do', data: {oid: orgId},
                success: function (res) {
                    if (res.status == "1") {
                        location.href = '/index.html';
                    } else {
                        GlobalApi.alertMsg("部门验证失败,请重试!");
                    }
                }
            });
        });
    }

    $(document).on("click.top",function () {
        $(".change-color").slideUp();
        $(".change-department").slideUp();
    });

    $($(".myFrame")[0].contentWindow).on("click.frame",function () {
        $(".change-color").slideUp();
        $(".change-department").slideUp();
    });

    window.FrameEvent&&FrameEvent.listenEvent("xOnSlideUp", function (flag) {
        $.each($(".frame-created"),function (i,v) {
            $($(v).context.contentWindow).click(function () {
                $(".change-color").slideUp();
                $(".change-department").slideUp();
            })
        })
    });
    var _beforeUnload_time = 0, _gap_time = 0;
    var is_fireFox = navigator.userAgent.indexOf("Firefox")>-1;
    window.onunload = function (){
        _gap_time = new Date().getTime() - _beforeUnload_time;
        if(_gap_time <= 3) {
            $.ajax({url: '/public/loginOut.do', type: 'post', sync:false});
            $.cookie('XID',null,{ expires: -1, path: '/' });
        }
    };
    window.onbeforeunload = function (){
        _beforeUnload_time = new Date().getTime();
        if(is_fireFox) {//火狐关闭执行
            $.ajax({url: '/public/loginOut.do', type: 'post', sync:false});
            $.cookie('XID',null,{ expires: -1, path: '/' });
        }
    };
</script>
</body>
</html>